#!/bin/sh
#
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
# [Modified to add Slackware-friendly conf file]

PATH=/usr/sbin:$PATH
export PATH

if [ -r /etc/default/gpsd ]; then
  . /etc/default/gpsd
elif [ -r /etc/sysconfig/gpsd ]; then
  . /etc/sysconfig/gpsd
  GPSD_OPTIONS=$OPTIONS
  GPSD_SOCKET=$CONTROL_SOCKET
elif [ -r /etc/rc.d/rc.gpsd.conf ]; then
  . /etc/rc.d/rc.gpsd.conf
fi

if [ -n "$GPSD_OPTIONS" ]; then
  export GPSD_OPTIONS
fi
if [ -n "$GPSD_SOCKET" ]; then
  export GPSD_SOCKET
fi

if [ -n "$USBAUTO" ]; then
  [ "$USBAUTO" = "true" ] || exit 0
fi

if [ "$ACTION" = "remove" ] ; then
  if echo $DEVLINKS | grep -q /dev/gps; then
    exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
  fi
  exit 0
fi

if [ -x /usr/bin/python ]; then
  exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
fi

